package com.share.wechat.core.service.impl;

import com.share.wechat.core.entity.UserAction;
import com.share.wechat.core.repository.inter.UserActionRepository;
import com.share.wechat.core.service.UserActionService;
import com.share.wechat.page.help.PageHelper;
import com.share.wechat.page.help.PageUtil;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserActionServiceImpl implements UserActionService {
    private final Logger logger = Logger.getLogger(this.getClass());
    @Resource
    private UserActionRepository userActionRepository;

    @Override
    public List<UserAction> getUserAction(String userId, int page, int size) {
        logger.debug("查询用户信息userID" + userId);
        PageUtil pageable = PageHelper.getPageUtil(page, size);
        List<UserAction> actionList = userActionRepository.findByUserId(userId, pageable);
        logger.debug("查询到的用户推荐的数据为" + actionList);
        return actionList;
    }
}
